package com.scofevil.sort;

public class InsertionSort {
	public static void sort(int[] src) {
		if (src == null || src.length == 0)
			return;
		for (int i = 1; i < src.length; i++) {
			int tmp = src[i];
			if (tmp >= src[i - 1])
				continue;
			for (int j = i - 1; j > 0; j--) {
				if(src[i]<src[j]){
					int tmp2 = src[i];
					src[i] = src[j];
					src[j] = tmp2;
					if(src[j]>=src[j-1])break;
				}
			}
		}
	}

	public static void main(String[] args) {

	}
}
